import http from '../../units/http'

/**
 *  教师页面的操作的api
 * @param params
 * @returns {AxiosPromise}
 */

//获取所有教师信息列表
export function getTeacherList(params){
    return http.get("/teacher/page",params);
}

//根据id查询教师信息
export function selectTeacherById(params){
  return http.get("/teacher/select/"+params)
}

// 更新教师信息
export function updateTeacher(params){
  return http.post("/teacher/update",params)
}

//  删除教师
export function deleteTeacher(params){
  return http.post("/teacher/delete",params)
}

/**
 * 教学机构操作的api
 * @param params
 * @returns {AxiosPromise}
 */

// 获取教学机构信息列表
export function getOrganization(params) {
  // console.log(params);
  return http.get("/organization/page",params)
}

// 新增机构
export  function addOrg(params){
  return http.post("/organization/insert",params)
}

// 查询机构信息根据id
export function selectOrgById(params){
  return http.post("/organization/select/"+params)
}

// 更新机构信息
export  function updateOrg(params){
  return http.post("/organization/update",params)
}

/**
 * 用户操作的api
 * @param params
 * @returns {AxiosPromise}
 */
// 获取用户列表
export function getUserList(params){
  return http.get("/sysuser/page",params)
}

/**
 * 销售团队操作的api
 * @param params
 * @returns {AxiosPromise}
 */
// 获取销售团队
export function getDeptList(params){
  return http.get("/dept/page",params)
}


/**
 * 销售人员的api
 * @param params
 * @returns {AxiosPromise}
 */
//  获取销售人员
export function getSalerList(params){
  return http.get("/saler/page",params)
}


//获取所有角色列表
export function getRoleList(params){
  return http.get("/sysRole/page",params)
}

//新增角色
export function addRole(params){
    return http.post("/sysRole/insert",params)
}
//根据id查找角色详情
export function getId(params){
    return http.get("/api/shy-auth/sys/role/get/"+params)
}
//根据id修改角色信息
export function updateRole(params){
    return http.post("/api/shy-auth/sys/role/update",params)
}

//根据id初始化角色权限分配
export function getRight(params){
    return http.get("/api/shy-auth/sys/right/get/"+params)
}
//根据id保存角色权限
export function saveRight(params){
    return http.post("/api/shy-auth/sys/right/save/"+params.roleid+"?funids="+params.funids)
}
//根据条件查询系统功能列表
export function getFunList(params){
    if(params.funtype && params.funstate && params.funpid){
        return http.get("/api/shy-auth/sys/fun/list?funtype="+params.funtype+"&funstate="+params.funstate+"&funpid="+params.funpid)
    }else if(params.funtype && params.funstate){
        return http.get("/api/shy-auth/sys/fun/list?funtype="+params.funtype+"&funstate="+params.funstate)
    }else if(params.funtype && params.funpid){
        return http.get("/api/shy-auth/sys/fun/list?funtype="+params.funtype+"&funpid="+params.funpid)
    }else if(params.funstate && params.funpid){
        return http.get("/api/shy-auth/sys/fun/list?funstate="+params.funstate+"&funpid="+params.funpid)
    }else if(params.funstate){
        return http.get("/api/shy-auth/sys/fun/list?funstate="+params.funstate)
    }else if(params.funpid){
        return http.get("/api/shy-auth/sys/fun/list?funpid="+params.funpid)
    }else if(params.funtype){
        return http.get("/api/shy-auth/sys/fun/list?funtype="+params.funtype)
    }else{
        return http.get("/api/shy-auth/sys/fun/list")
    }
}
//增加系统功能
export function funInsert(params){
    return http.post("/api/shy-auth/sys/fun/insert",params)
}
//根据id修改系统功能
export function funUpdate(params){
    return http.post("/api/shy-auth/sys/fun/update",params)
}
